<extend name="Public/base" />

<block name="body">
    <link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
    <php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
    <link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>

    <!-- 标题栏 -->
    <div class="main-title">
        <h2>{$meta_title}</h2>
    </div>
    <div class="cf">
        筛选:
            <form action="{:U('index')}" method="POST">
                <input type="text" name="seller_sku" class="text input-2x" value="{$seller_sku}" placeholder="SKU" /> &nbsp; &nbsp; 
                最后更新日期：<input type="text" name="start_date" class="select_date text input-2x" value="{$start_date}" placeholder="开始时间" />-
                <input type="text" name="end_date" class="select_date text input-2x" value="{$end_date}" placeholder="结束时间" />
                <button class="btn">搜索</button>
            </form>
            <br/>
            <hr>
            获取订单:
            <br/>
            SKU更新时间：<input type="text" class="select_date text input-2x" id="date1" placeholder="最后更新时间" />
            <a class="btn" id="getSku" href="javascript:;">获 取</a>
            <!--            <button class="btn ajax-post confirm" url="{:U('changeStatus?method=deleteUser')}" target-form="ids">删 除</button>-->

        <!--<br/>-->
        <!-- 高级搜索 -->
        <div class="search-form fl cf">
            
        </div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
        <table class="">
            <thead>
                <tr>
                    <th class="row-selected row-selected"><input class="check-all" type="checkbox" style="display:none;"/></th>
                    <!--<th class="">amazon订单ID</th>-->
                    <th class="">SKU</th>
                    <th class="">ASIN</th>
                    <th class="">FNSKU</th>
                    <th class="">实际库存</th>
                    <th class="">在途库存</th>
                    <th class="">添加日期</th>
                    <th class="">最后更新日期</th>
                    <th class="">操作</th>
                </tr>
            </thead>
            <tbody>
            <notempty name="_list">
                <volist name="_list" id="vo">
                    <tr>
                        <td><input class="ids" type="checkbox" name="id[]" value="{$vo.id}" /></td>
                        <td>{$vo.seller_sku} </td>
                        <td>{$vo.asin}</td>
                        <td>{$vo.fnsku}</td>
                        <td>{$vo.total_supply_quantity}</td>
                        <td>{$vo.in_stock_supply_quantity}</td>
                        <td>{$vo.create_time}</td>
                        <td>{$vo.update_time}</td>
                        <td><a href="{:U('info',array('id'=>$vo['id']))}">查看在途库存</a></td>
                    </tr>
                </volist>
                <else/>
                <td colspan="20" class="text-center"> aOh! 暂时还没有内容! </td>
            </notempty>
            </tbody>
        </table>
    </div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

    <script type="text/javascript">
        //搜索功能
        $("#search").click(function () {
            var url = $(this).attr('url');
            var query = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            query = query.replace(/^&/g, '');
            if (url.indexOf('?') > 0) {
                url += '&' + query;
            } else {
                url += '?' + query;
            }
            window.location.href = url;
        });
        
        $("#getSku").click(function(){
            var date1 = $('#date1').val();
            
             $.post("{:U('MwsStock/getMwsStock')}", {query_date_time:date1}, function (res) {
                    if(res.status==1){
                        alert(res.msg);
                    }
                });
        });
        
        //回车搜索
        $(".search-input").keyup(function (e) {
            if (e.keyCode === 13) {
                $("#search").click();
                return false;
            }
        });
        //导航高亮
        highlight_subnav("{:U('AmazonSku/index')}");

        $('.select_date').datetimepicker({
            format: 'yyyy-mm-dd',
            language: "zh-CN",
            minView: 2,
            autoclose: true
        });

    </script>
</block>
